package com.zhxl.server.utils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @description:封装json对象，所有返回结果都使用它
 **/
@ApiModel(value = "图片返回类")
public class UploadResult<T> {

	@ApiModelProperty(value = "error")
	private int error;// 业务自定义状态码
	@ApiModelProperty(value = "对象")
	private T data;// 请求数据，对象或数组均可

	public UploadResult() {
	}



	/**
	 * 成功的构造函数
	 * @param data data
	 */
	public UploadResult(int error, T data){
		this.error = error;//默认0是成功
		this.data = data;
	}

	public int getError() {
		return error;
	}

	public void setError(int error) {
		this.error = error;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

	@Override
	public String toString() {
		return "UploadResult{" +
				"error=" + error +
				", data=" + data +
				'}';
	}
}